package yxy.game.pm2.active.module.therion;

import yxy.apple.util.PubSub;
import yxy.game.pm2.bean.mq.CCReason;
import yxy.game.pm2.bean.pubsub.TherionPublisher;
import yxy.game.pm2.module.NotificationHandle;
import yxy.game.pm2.module.therionHunting.TherionModule;
import yxy.game.pm2.module.therionHunting.TherionPlayerModule;

/**
 * @name TherionSubscriber_神兽复活
 * @author wrs
 * @description 神兽复活 消息订阅
 * @since 2022-06-17
 */
public class TherionSubscriber_神兽复活 extends PubSub.MethodSubscriber {

    static private TherionSubscriber_神兽复活 instance;

    public static TherionSubscriber_神兽复活 getInstance() {
        if (instance == null) {
            instance = new TherionSubscriber_神兽复活();
            instance.init();
        }
        return instance;
    }

    private void init() {
        TherionPublisher.getInstance().subscribe(this);
    }

    private TherionSubscriber_神兽复活(){}

    @PubSub.SubscriptionMethod(Type = TherionPublisher.TherionSubscription.class)
    public void receive(TherionPublisher.TherionSubscription subscription) {
        String playerCode = subscription.getPlayerCode();
        CCReason reason = subscription.getReason();
        int gameType = subscription.getGameType();
        int therionType = subscription.getTherionType();

        //todo 取消玩家的神兽复活提示勾选
        TherionPlayerModule.get(playerCode).getIsBooked().get(gameType).put(therionType,0);
        TherionModule therionModule = TherionModule.get(gameType, playerCode, therionType);
        if (therionModule != null){
            //推送
            new NotificationHandle().notifyTherionResurgence(playerCode,therionModule);
        }
    }
}
